import Mock from 'mockjs'

Mock.mock(/login/,function(options) {
  console.log('login的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    username:'@ctitle(4,8)',
    userId:'@integer'
  })
})

function getRImg () {
  return Mock.Random.image('700x300', Mock.Random.hex())
}

Mock.mock(/getSlides/,function(options) {
  console.log('getSlides的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    invTimes: 2000,
    list:[
      {
        title:'@ctitle(4,12)',
        src:require('../assets/slideShow/pic1.jpg'),
        toKey:'analysis'
      },
      {
        title:'@ctitle(4,12)',
        src:require('../assets/slideShow/pic2.jpg'),
        toKey:'count'
      },
      {
        title:'@ctitle(4,12)',
        src:require('../assets/slideShow/pic3.jpg'),
        toKey:'publish'
      },
      {
        title:'@ctitle(4,12)',
        src:require('../assets/slideShow/pic4.jpg'),
        toKey:'forecast'
      }
    ]
  })
})

Mock.mock(/getNewList/,function(options) {
  console.log('getNewList的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    'list|5':[{
      'url':'@url',
      'title':'@ctitle(5,20)'
    }]
  })
})

Mock.mock(/getBoardList/,function(options) {
  console.log('getBoardList的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock([
    {
      title:'@ctitle(4)',
      description: '@ctitle(8, 12)',
      id:'car',
      toKey:'analysis',
      saleout: '@boolean'
    },
    {
      title: '@ctitle(4)',
      description: '@ctitle(8, 12)',
      id: 'earth',
      toKey: 'count',
      saleout: '@boolean'
    },
    {
      title: '@ctitle(4)',
      description: '@ctitle(8, 12)',
      id: 'loud',
      toKey: 'forecast',
      saleout: '@boolean'
    },
    {
      title: '@ctitle(4)',
      description: '@ctitle(8, 12)',
      id: 'hill',
      toKey: 'publish',
      saleout: '@boolean'
    }
  ])
})

Mock.mock(/getProductList/,function(options) {
  console.log('getProductList的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    pc: {
      title: 'PC产品',
      list: [
        {
          name: '@ctitle(4)',
          url: '@url',
          hot: '@boolean'
        },
        {
          name: '@ctitle(7)',
          url: '@url',
          hot: '@boolean'
        },
        {
          name: '@ctitle(3)',
          url: '@url',
          hot: '@boolean'
        },
        {
          name: '@ctitle(4)',
          url: '@url',
          hot: '@boolean'
        }
      ]
    },
    app: {
      title: '手机应用类',
      last: true,
      list: [
        {
          name: '@ctitle(4)',
          url: '@url',
          hot: '@boolean'
        },
        {
          name: '@ctitle(5)',
          url: '@url',
          hot: '@boolean'
        },
        {
          name: '@ctitle(6)',
          url: '@url',
          hot: '@boolean'
        },
        {
          name: '@ctitle(4)',
          url: '@url',
          hot: '@boolean'
        }
      ]
    }
  })
})

Mock.mock(/getPrice/,function(options) {
  console.log('getPrice的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    price:'@float(60, 100, 2, 2)'//后两位是小数部分最小位数和最大位数
  })
})

Mock.mock(/createOrder/,function(options) {
  console.log('createOrder的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    orderId:'@id'
  })
})

Mock.mock(/checkOrder/, function(options) {
  console.log('checkOrder的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    status:'@boolean'
  })
})

/*Mock.mock(/getTableData/, {
  "total": 25,
  "list|10": [
    {
      "orderId": "@id",
      "product": "@ctitle(4)",
      "version": "@ctitle(3)",
      "period": "@integer(1,5)年",
      "buyNum": "@integer(1,8)",
      "date": "@date()",
      "amount": "@integer(100, 500)元"
    }
  ]
})*/

Mock.mock(/getOrderList/, function(options) {
  console.log('getOrderList的axios传值为：' + options.body)//数据请求的传值
  return Mock.mock({
    "total": 25,
    "list|10": [
      {
        "orderId": "@id",
        "product": "@ctitle(4)",
        "version": "@ctitle(3)",
        "period": "@integer(1,5)年",
        "buyNum": "@integer(1,8)",
        "date": "@date()",
        "amount": "@integer(100, 500)元"
      }
    ]
  })
})

